﻿using System;
using System.Data;
using System.Linq;
using ReflectionStudio.Core.Events;
namespace WPFExcelReport
{
    public partial class ITXEXRPT
    {

        private void JLTEK02(DataSet db)
        {
            try
            {
                DataTable tbABPOS = db.Tables["EKPOS"]; 
                DataTable dtOutput = new DataTable();
                //EKPAUFKRS,EKPAUFLFD,SUPP,SUPPNAME,YARN,YARNDES,LASTDAT,EKKBDAT,SCHNO
                dtOutput.Columns.Add("SCHNO", typeof(System.String));
                dtOutput.Columns.Add("EKPAUFKRS", typeof(System.String));
                dtOutput.Columns.Add("EKPAUFLFD", typeof(System.String));
                dtOutput.Columns.Add("SUPP", typeof(System.String));
                dtOutput.Columns.Add("SUPPNAME", typeof(System.String));
                dtOutput.Columns.Add("YARN", typeof(System.String));
                dtOutput.Columns.Add("YARNDES", typeof(System.String));
                dtOutput.Columns.Add("ORDERQTY", typeof(System.String));
                dtOutput.Columns.Add("INQTY", typeof(System.String));
                dtOutput.Columns.Add("REMAINQTY", typeof(System.String));
                dtOutput.Columns.Add("LASTDAT", typeof(System.String));
                dtOutput.Columns.Add("EKKBDAT", typeof(System.String));
                dtOutput.Merge(tbABPOS, false, MissingSchemaAction.Ignore);

                foreach (DataRow row in dtOutput.Rows)
                {

                    row["SUPPNAME"] = GetGB2312Value(row["SUPPNAME"].ToString());
                    row["YARN"] = GetGB2312Value(row["YARN"].ToString());
                    row["YARNDES"] = GetGB2312Value(row["YARNDES"].ToString());
                }
                exAgent.DataTableToExcel(dtOutput, 2, 1);
                int count = dtOutput.Rows.Count;
                exAgent.BatchConvert2Number(2, 8, count + 1, 10);
               
                

            }
            catch (Exception ex)
            {
                Tracer.Error(ex.StackTrace, ex);
            }
        }
        
    }
}